/* 
 * File:   matrix.h
 * Author: gustavo
 *
 * Created on August 11, 2011, 6:17 AM
 */

#ifndef MATRIX_H
#define	MATRIX_H

#include <iostream>

template< class T >
class Matrix {
protected:
    int rows;
    int columns;
    int depth;
    long int size;
    T * data;


public:

    char c;

    Matrix() {
    };

    Matrix(int rows, int columns, int depth) {
        init(rows, columns, depth);
    }

    Matrix(int rows, int columns) {
        init(rows, columns, 1);
    }

    virtual ~Matrix() {

        std::cout << "Deleting Matrix " << this->c << std::endl;

        delete this->data;
        this->data = 0x0;
    }

    T * getData();
    long int getSize() const;
    int getDepth() const;
    int getColumns() const;
    int getRows() const;

protected:

    void init(int rows, int columns, int depth) {
        this->rows = rows;
        this->columns = columns;
        this->depth = depth;
        this->size = rows * columns * depth;
        this->data = new T[ this->size ];
    }
};

template <class T> T * Matrix<T>::getData() {
    return this->data;
}

template <class T> long int Matrix<T>::getSize() const {
    return this->size;
}

template <class T> int Matrix<T>::getDepth() const {
    return this->depth;
}

template <class T> int Matrix<T>::getColumns() const {
    return this->columns;
}

template <class T> int Matrix<T>::getRows() const {
    return this->rows;
}


#endif	/* MATRIX_H */

